<%@page import="java.util.Locale"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="java.math.BigInteger"%>
<%@page import="com.bionic.banking.logic.controller.BankAccountController"%>
<%@page import="com.bionic.banking.core.entity.BankAccount" %>
<%@page language="java"%>
<%
    Integer accountId = Integer.parseInt(request.getParameter("id"));    
    Integer customerId = Integer.parseInt(request.getParameter("customerId"));
    String accountType=(String)request.getParameter("accountType");
    String description=(String)request.getParameter("description");    
    BigInteger balance= new BigInteger(request.getParameter("balance"));
    BigInteger creditLine= new BigInteger(request.getParameter("creditLine"));
    Integer currencyId=Integer.parseInt(request.getParameter("currencyId"));
    
    //DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.US);//new SimpleDateFormat("MM/dd/yy");    
    //Date  createdon = df.parse(request.getParameter("createdon")); //TODO:
    //Date createdon= DateFormat.getDateInstance().parse(request.getParameter("createdon"));        
    try
    {
            //Init entity
            BankAccount entity = new BankAccount();                
            entity.setAccountId(accountId);
            entity.setAccountType(accountType);
            entity.setCustomerId(customerId);          
            entity.setBalance(balance);                       
            entity.setDescription(description);  
            entity.setCurrencyId(currencyId);     
            entity.setCreditLine(creditLine);
            //entity.setUpdatedon(updatedon);        
            //entity.setCreatedon(createdon);        
               
            //Use session bean to update entity
            BankAccountController bean = new BankAccountController();
            bean.update(entity);
            
            //redirect to list
            response.sendRedirect("../Controller?command=viewBankAccountsList");//"List.jsp");   
    }
    catch(Exception e)
    {
          System.out.println(e);
    }
%>